<%-- 
    Document   : ValidateEmail
    Created on : 29/07/2014, 09:03:41 AM
    Author     : Luis.Parada
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript">
            function validarEmail(email, input_id) {                
                expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                if (!expr.test(email)) {
                    alert("Error: La dirección de correo " + email + " es incorrecta.");
                    document.getElementById(input_id).value = "";
                    alert(document.getElementById(input_id).id);
                }
            }
        </script>
    </head>
    <body>
        E-mail
        <input id="e-mail" type="text" value="" placeholder="Ingrese su E-mail" onchange="validarEmail(this.value, this.id)"/>
    </body>
</html>
